package com.ax.center.controller;

import com.ax.center.annotation.Logging;
import com.ax.center.dto.ApiResponse;
import com.ax.center.entity.UserLogin;
import com.ax.center.service.LoginService;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

/**
 * @author zy
 * @date 2023/7/3 17:41
 */

@RestController
@RequestMapping(value = "/loginController")
@Api(tags = "登录服务")
@CrossOrigin(origins = "http://localhost:5173")
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping(value = "/login")
    @ApiOperation(value = "登录接口")
    @Logging(description = "用户登录")
    public ApiResponse login(@RequestBody UserLogin userLogin)  {
        return loginService.login(userLogin.getId(),userLogin.getPassword());
    }
}
